USE [wdms]
GO

-- =============================================
-- Author     :		Lohith Ram D V
-- Create date:         07/mar/2011
-- Description:	Removes a document from the database.
--              May add role checking int the future.
-- =============================================

create procedure sp_DeleteDocumentByID( 
	@par_docid int)
AS
BEGIN
	DELETE FROM [Doc_Checked]
	WHERE [Doc_Checked].[doc_id]=@par_docid;
	
	DELETE FROM [Doc_Dept]
	WHERE [Doc_Dept].[doc_id]=@par_docid;
	
	DELETE FROM [Doc_Modification]
	WHERE [Doc_Modification].[doc_id]=@par_docid;
	
	DELETE FROM [Doc_Share]
	WHERE [Doc_Share].[doc_id]=@par_docid;
	
	DELETE FROM [Document]
	WHERE [Document].[doc_id]=@par_docid;
END
